Wordpress Migration from Localhost to Server
I was looking to build out a Wordpress sight locally and deploy the SQL + Wordpress files onto a remote server. There is a few steps involved to make sure login, links, and db all play nicely together after the transfer
Local Prep
- bundle wordpress files into a single zip folder. contents will look something like this
wp-mynewsight-local.zip
wp-admin
wp-content
wp-includes
.htaccess
index.php
...
- Delete
wp-config.php
- visit the local build's PHPMyAdmin app
export
the database- method =
quick
- format =
SQL
- file will download as
mynewsight-local_db.sql
- method =
Transfer to Server
I'm deploying this sight onto Bluehost.com so I had to create a fresh sight first, then transfer data onto it
upload Wordpress files
- Using CPanel, access the File Manager
- navigate to the server's new wordpress files. Example:
public_html/mynewsight-com
- upload the
wp-mynewsight-local.zip
, unzip, and replace any matching file names
~~11. editwp-config.php
define('DB_NAME', 'mynewsight_db');
define('DB_NAME', 'mynewsight_user');
define('DB_NAME', 'super_strong_password');
~~
- edit
wp-config.php
- take note of the
Table Prefix
→ example:S4B_
- change the table prefix to match your locally developed SQL file
Table Prefix
→ example:wp_
edit database
- Login to Server's CPanel
- Launch MySQL® Databases
~~ 1. create new database →mynewsight_db
2. create new user →mynewsight_user
(with strong password)
2. add new user to new database with all previleges~~ - Look inside to find the database with the matching table prefixes →
S4B_
add new user with same password from the local build's db. With all permissions enabled (my caseadmin_mynewsight
)- click the database and import the local db file
db_mynewsight-local.sql
- edit
wp_options
- siteurl =
https://mynewsight.com
- home =
https://mynewsight.com
- siteurl =
- you can delete the old tables prefixed with
S4B_
. I just let them be - visit your sight and login
https://mynewsight.com/wp-admin
- fix all internal permalinks links via
https://mynewsight.com/wp-admin/options-permalink.php
and hit the button - confirm
Search Engine Visibility
is set to off viahttps://mynewsight.com/wp-admin/options-reading.php